package com.aios.action.timer;
import org.apache.log4j.Logger;



public class TimerDeleteAction extends AbstractTimerAction {
	private static final long serialVersionUID = 1L;
	private static Logger logger = Logger.getLogger(TimerDeleteAction.class);
	
public String execute() {

		if(id != null) {
			
			try {
				timerService.delete(id);
			} catch(Exception e) {
				logger.error(e);
				addActionError(getText("global.error.delete"));
				return ERROR;
			}
			
		} else {
			logger.error("Trying to delete a timer without passing its id");
			addActionError(getText("global.error.delete"));
			return ERROR;
		}
		
		addActionError(getText("global.success.delete"));
		return SUCCESS;
	}
}
